package com.fbt.transfer.app.driver.model;

import com.fbt.transfer.app.driver.util.Constants;
import lombok.Getter;

/**
 * @author tuocoo
 * @date 2020年05月27日/17:32
 */
@Getter
public enum AccountStatusEnum {
  /** 司机审核 */
  REJECTED(-1, "拒绝通过"),
  WAIT_FOR_REVIEW(0, "待审"),
  PASS(1, "正常"),
  NO_UPLOAD_OWNER_INFO(2, "资料待完善"),
  FORBIDDEN(10, "封禁"),
  ;

  private final Integer status;

  private final String desc;

  AccountStatusEnum(Integer status, String desc) {
    this.status = status;
    this.desc = desc;
  }

  public static String[] all() {
    return new String[] {
      Constants.ALL,
      REJECTED.desc,
      WAIT_FOR_REVIEW.desc,
      PASS.desc,
      NO_UPLOAD_OWNER_INFO.desc,
      FORBIDDEN.desc
    };
  }

  public static Integer getByDesc(String desc) {
    for (AccountStatusEnum serviceType : AccountStatusEnum.values()) {
      if (serviceType.getDesc().contains(desc)) {
        return serviceType.getStatus();
      }
    }
    return null;
  }
}
